package com.yunhe.mybatis.web.mett;

import com.yunhe.mybatis.entity.Meet;
import com.yunhe.mybatis.service.MeetService;
import com.yunhe.mybatis.service.impl.MeetServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/meet/save")
public class SaveServlet extends HttpServlet {
    private  MeetService meetService = new MeetServiceImpl();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String biaoti = req.getParameter("biaoti");
        Integer typee = Integer.valueOf(req.getParameter("typee"));
        String nenrong = req.getParameter("nenrong");
        String riqi = req.getParameter("riqi");

        Meet meet = new Meet();

        meet.setName(biaoti);
        meet.setNenrong(nenrong);
        meet.setTypee(typee);
        meet.setRiqi(riqi);

        meetService.save(meet);
        req.getRequestDispatcher("/success.jsp").forward(req,resp);


    }

}
